function getFileBase64 (obj, fnc) {
	let reader = new FileReader ()
	reader.readAsDataURL (obj)
	reader.onload = function (e) {
		fnc (e.target.result)
	}
}
function setImg (call) {
	let base64
	let input = document.createElement ('input')
	input.setAttribute ('type', 'file')
	input.setAttribute ('accept', 'image/*')
	input.addEventListener ('change',
		(e) => base64 = getFileBase64 (e.currentTarget.files[0], call))
	input.click ()
}
function getDays() {
	let now = new Date().valueOf(), day = 24 * 60 * 60 * 1000, prev0 = now - day, prev1 = prev0 - day,
		prev2 = prev1 - day, prev3 = prev2 - day, prev4 = prev3 - day, prev5 = prev4 - day
	return [now, prev0, prev1, prev2, prev3, prev4, prev5].reverse().map(v => {
		let d = new Date(v)
		return `${d.getMonth() + 1}-${d.getDate()}`
	})
}
export {setImg,getDays}
